const router = require('express').Router()
const upload = require('../utils/multer')

router.post('/upload',upload.single('img'),(req,res)=>{
    console.log(req.file)
    // req.file 保存了 上传图片  信息
    let filename = '/uploads/'+req.file.filename
    res.send({
        code:0,
        msg:"上传成功",
        data:{
            filename
        }
    })
})

module.exports = router;